﻿@model PagedList.IPagedList<MobileDesigner.Models.SubordinatesListModel>
@{
    ViewBag.Title = "Ваши сотрудники";
}

<h2>Ваши сотрудники</h2>

@using (Html.BeginForm())
{
    <p>
        Поиск: @Html.TextBox("SearchString", ViewBag.CurrentFilter as string) &nbsp;
        <input type="submit" value="Искать" /></p>
}

<table>
    <tr>
        <th>
            @Html.ActionLink("Электронный адрес", "ListSubordinates", new { sortOrder=ViewBag.EmailSortParm, currentFilter=ViewBag.CurrentFilter })
        </th>
        <th>
            Номер телефона
        </th>
        <th>
            @Html.ActionLink("Имя", "ListSubordinates", new { sortOrder=ViewBag.NameSortParm, currentFilter=ViewBag.CurrentFilter })
        </th>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td>
            @Html.DisplayFor(modelItem => item.Email)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Phone)
        </td>
        <td>
            @Html.DisplayFor(modelItem => item.Name)
        </td>
        <td>
            @Html.ActionLink("Проекты", "ProjectsList", new { id = item.ID } ) 
            @Html.ActionLink("Сотрудники", "ListSubordinates", new { id = item.ID } ) 
            @Html.ActionLink("Клиенты", "SubordinateClientList", new { id = item.ID } ) 
        </td>
    </tr>
}

</table>

<div>
    Page @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    of @Model.PageCount
    &nbsp;
    @if (Model.HasPreviousPage)
    {
        @Html.ActionLink("<<", "ListSubordinates", new { page = 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
        @Html.Raw("&nbsp;");
        @Html.ActionLink("< Prev", "ListSubordinates", new { page = Model.PageNumber - 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
    }
    else
    {
        @:<<
        @Html.Raw("&nbsp;");
        @:< Prev
    }
    &nbsp;
    @if (Model.HasNextPage)
    {
        @Html.ActionLink("Next >", "ListSubordinates", new { page = Model.PageNumber + 1, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
        @Html.Raw("&nbsp;");
        @Html.ActionLink(">>", "ListSubordinates", new { page = Model.PageCount, sortOrder = ViewBag.CurrentSort, currentFilter=ViewBag.CurrentFilter  })
    }
    else
    {
        @:Next >
        @Html.Raw("&nbsp;")
        @:>>
    }
</div>